package demo3;

import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;

public class Text03 {
    public static void main(String[] args) {
        // 原子类
        AtomicInteger atomicInteger = new AtomicInteger();

        // 获取当前的值
        System.out.println(atomicInteger.get());
        // 自增 i++
        atomicInteger.getAndIncrement();
        System.out.println(atomicInteger.get());
        // 自增 ++i
        System.out.println(atomicInteger.incrementAndGet());
        // 自减 i--
        atomicInteger.getAndDecrement();
        System.out.println(atomicInteger.get());
        // 自减 --i
        System.out.println(atomicInteger.decrementAndGet());
        // 累加 i+x
        atomicInteger.getAndAdd(100);
        System.out.println(atomicInteger.get());
        System.out.println(UUID.randomUUID());
        System.out.println(UUID.randomUUID());
        System.out.println(UUID.randomUUID());
        System.out.println(UUID.randomUUID());
    }
}
